const locales = require("koa-locales");

import { root, getServerConfig } from "../libs/utils";
const clientConfig = getServerConfig().client;
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
const locale = (app: any): void => {
  locales(app, {
    functionName: "t",
    defaultLocale: clientConfig.language || "en",
    queryField: "language",
    cookieField: "language",
    localeAlias: {},
    dirs: [root("server/locales")],
  });
};

export default locale;
